package org.particlethink.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.particlethink.auth.DefaultUser;
import org.particlethink.mapper.DictMapper;
import org.particlethink.response.BaseResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Tag(name = "下拉选项菜单", description = "下拉选项菜单相关api")
@RestController
@RequestMapping("/option")
public class OptionsController {

    @Autowired
    public DictMapper dictMapper;

    @Operation(summary = "项目管理层级列表")
    @GetMapping("/project_management_levels")
    public BaseResponse<List<String>> getProjectManagementLevels() {
        DefaultUser defaultUser = (DefaultUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        return BaseResponse.success(dictMapper.projectManages(defaultUser.getUser().getToken()));
    }

}
